<?php
exit;
$nianji=5;
    include '../c/config.php';
    $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
    if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqli->error);}
    $query=$mysqli->query("SELECT * FROM `ti` where nianji=".$nianji." and step=1   ");
    $i=1;
    $yi=array();
    while ($list=$query->fetch_array()) {
        $yi[$i]=$list['dan'];
    
        $i++;
     }
var_dump($yi);
echo "<br /><br />";
     
?>


<?php
//第二部分
$query=$mysqli->query("SELECT * FROM `ti` where nianji=".$nianji." and step=2  ");
$i=1;
$er=array();
while ($list=$query->fetch_array()) {
    $er[$i]=$list['dan'];
 
    $i++;
 } 
var_dump($er);
echo "<br /><br />";

?>


<?php
//第三部分

$san=array();
$query=$mysqli->query("SELECT * FROM `ti` where nianji=".$nianji." and step=3   ");
$i=1;
 
while ($list=$query->fetch_array()) {
      $san[$i]=$list['dan'];
 
    $i++;
 }
var_dump($san);
echo "<br /><br />";

$data= array(
  'yi' => $yi, 
  'er' => $er,
  'san' => $san
);

var_dump($data);
echo "<br /><br />";

file_put_contents($nianji.'.txt', json_encode($data));

?>